using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using Abp.Dependency;
using Abp.Domain.Entities.Auditing;
using Abp.Domain.Repositories;
using Yozeev.SystemConfig;

namespace Yozeev.Common
{
    public interface IQueryHelper: ITransientDependency
    {
        Expression<Func<T, bool>> WhereExp<T>(ICollection<QueryData> queryData) where T : class, new();

        /// <summary>
        /// 根据权限类型查询数据
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="whereExp">原查询条件</param>
        /// <param name="viewType">数据查看类型</param>
        /// <param name="branchUser">机构用户</param>
        /// <returns></returns>
        Expression<Func<T, bool>> SetWhereExp<T>(Expression<Func<T, bool>> whereExp, ViewTypeEnum viewType, BranchUser branchUser) where T : ByBranchEntity<Guid>;

        IQueryable<T> GetAllQueryable<T, P>(
            IRepository<T, P> repository,
            object dto,
            string minDatePropPrefix = "MinDate",
            string maxDatePropPrefix = "MaxDate") where T : class, Abp.Domain.Entities.IEntity<P>;
    }
}
